package com.ncu.xrpc.sample1.control;

import com.ncu.xrpc.api.HelloWordService;
import com.ncu.xrpc.proxy.RpcProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 * User: xiongwb
 * Date: 2021/9/12 16:35
 */
@RestController
@RequestMapping("/test")
@Validated
public class RpcTest {

    @Autowired
    private RpcProxy rpcProxyBean;

    @GetMapping("/rpc")
    public void test(){
        HelloWordService rpcProxyBeanProxy = rpcProxyBean.createProxy(HelloWordService.class);
        String result = rpcProxyBeanProxy.test("xiongwb");
        System.out.println(result);
    }
}
